import java.util.Arrays;

abstract class BusLine {
    public String name;
    // 公交路线站点列表
    public String[] stations;
    // 构造函数
    public BusLine(){

    }
    public BusLine( String name, String[] stations) {
        this.name = name;
        this.stations = stations;
    }
    // 获取公交路线名称
    public String getName() {

        return name;
    }
    public void setName(String name ){

        this.name =name;
    }
    // 获取公交路线站点列表
    public String[] getStations() {
        return stations;
    }
    public void  setStations(String[] stations){

        this.stations=stations;
    }


    // 检查公交路线是否包含指定站点
    public  abstract void containsStation(String stationName);

}
class SubBusRoute extends BusLine {
    //调用父类的构造方法
    public SubBusRoute(){
        super();
    }
    public SubBusRoute(String name, String[] stations) {
        super(name, stations);
    }
    @Override
    public String toString() {
        return "SubBusRoute{" +
                "name='" + name + '\'' +
                ", stations=" + Arrays.toString(stations) +
                '}';
    }
    //重写父类的方法
    public  void containsStation(String stationName) {
        int flg = 0;
        for (String station : stations) {
            flg = 0;
            if (station.equals(stationName)) {
                System.out.println(getName() + ":" + "找到了包含站点" + stationName + "的公交路线");
                System.out.println(toString());
                flg = 1;
                break;
            }

        }
        if (flg == 0) {
            System.out.println(getName() + ":" + "没有找到包含站点" + stationName + "的公交路线");
        }
    }
}
public class BusRouteQuerySystem{
    static String stationName="C";//静态常量
    //静态方法
    public static void find(BusLine busRoute){
        busRoute.containsStation (stationName);
    }
    public static void main(String[] args) {
        BusLine busLine1= new SubBusRoute("101",new String[]{"A","B","C","D","E"});
        BusLine busLine2= new SubBusRoute("102",new String[]{"B","G", "D", "E","F"});
        find(busLine1);
        find(busLine2);
    }
}